<?php
	session_start();
	
	@chdir("../../");
	define('ABS_URL',str_replace("\\","/",getcwd()));
	require ABS_URL.'/engine/Smarty.class.php';
	require ABS_URL."/functions/class.query.inc.php";
	$smarty = new Smarty();
	require ABS_URL."/dev_con.inc.php";
	require ABS_URL."/functions/func_file.php";
	$queryData = new queryData();
	$queryData->baseConfig();
	require ABS_URL."/functions/func_content.php";
	require ABS_URL."/langs/".BASE_LANGUAGE.'.inc.php';
	require $queryData->get_curr_dir(dirname(__FILE__))."/langs/".BASE_LANGUAGE.'.inc.php';

	$nama_lengkap = $_POST['nama_depan']."[spasi]".$_POST['nama_belakang'];
	$jenis_kelamin = $_POST['jk'];
	$lahir = $_POST['tempat_lahir']."[spasi]".$_POST['tgl']."[spasi]".$_POST['bulan']."[spasi]".$_POST['tahun'];
	$telp_hp = $_POST['telp_hp'];
	$aktivasi = 0;
	$randomNumber = mt_rand(1000,9999);
	$namauser = trim($_POST['nama_depan']);
	$namauser = strtolower($_POST['nama_depan']).$randomNumber;
	$alias = $_POST['nama_depan']." ".$_POST['nama_belakang'];
	$pass = md5($namauser);
	$type_user = $_POST['tipe'];
	$tanggal = date("Y-m-d-H-i-s");
		
	$sql = "INSERT INTO tbl_login VALUES('','".$namauser."','".$alias."','".$pass."','".$aktivasi."','".$type_user."','".$tanggal."','".$tanggal."')";
	$qry = mysql_query($sql);
	
	$sqlQ = "SELECT LAST_INSERT_ID() as idX FROM tbl_login";
	$qryQ = mysql_query($sqlQ);
	$rowQ = mysql_fetch_object($qryQ);
	
	$filename = 'index.php';
	
	if (defined('USE_REWRITE')) {
		$filename = str_replace("index.php",USE_REWRITE,$filename);
	}
	
	header("Location:../../".$filename."?show=".$_GET['show']."&showview=".$_GET['showview']);
?>